package com.xll.springcloud.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.xll.springcloud.service.SchedualServiceHi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: xialonglei469
 * @Date: 2019-2-20 15:29
 * @Version 1.0
 */
@RestController
public class HelloController {

    @Autowired
    private SchedualServiceHi schedualServiceHi;

    @GetMapping(value = "/hi")
    @HystrixCommand(fallbackMethod = "helloFallback")
    public String sayHi(@RequestParam String name) {
        return schedualServiceHi.sayHiFromClientOne(name);
    }

    public String helloFallback(String name) {
        return "error";
    }
}
